package com.deyuanyun.pic.web.timedtask;

import com.alibaba.fastjson.JSON;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.Arrays;
import java.util.List;

/**
 * Created by xu on 2016/1/26.
 * 定时任务的配置文件
 */
@Component
public class TaskConfigBean {
    @Value("${TABLE_INFO}")
    private String tableInfo;//表名
    /*@Value("${TIME_INTERVAL}")
    private String timIinterval;//时间间隔 分钟*/
    @Value("${TASK_LIST}")
    private String taskList;//任务清单
    @Value("${IS_TASK_SERVER}")//是否是任务服务器
    private String isTaskServer;


    public String isTaskServer(){
        return isTaskServer;
    }
    public List<TaskTableInfo> taskTableInfoList(){
        List<TaskTableInfo> taskTableInfoList= JSON.parseArray(tableInfo,TaskTableInfo.class);
        return taskTableInfoList;
    }
    public List<String> getTaskListList(){
        String s=getTaskList();
        if (StringUtils.isBlank(s)||"false".equalsIgnoreCase(s)){
            return null;
        }
        String[] arr= StringUtils.split(s,",");
        return Arrays.asList(arr);
    }

    public String getTaskList() {
        return taskList;
    }




}
